package com.wl.scanner;

import java.util.Scanner;

/**
 * @author wanglei
 */
public class Demo3 {
    public static void main(String[] args) {
        //输入多个数字，并求其总和与平均数，每次输入一个数字用回车确认，通过输入非数字来结束输入并输出执行结果
        Scanner scanner = new Scanner(System.in);

        double sum = 0;
        int i = 0;
        while (scanner.hasNextDouble()){
            double d = scanner.nextDouble();
            i++;
            sum = sum + d;
        }
        System.out.println(i+"个数总和:"+sum);
        System.out.println(i+"个数平均数:"+(sum/i));

        scanner.close();
    }
}
